<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<s:property value="#application.systemInfor.webName"/>－找回密码
</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/tools/jquery-1.4.2.min.js"></script>
<script>

 var isSuccessEmail=false;
 function checkUserEmail()
 {
    var email=$.trim($("input[name='email']").val());
     var str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
     $("#errorInfor").remove();      
     
    if(email=="")
    {
      alert("Email 不能为空！");
      isSuccessEmail=false;
    }else if(!str.test(email))
    {
      alert("Email 格式不对！");
      isSuccessEmail=false;
    }else
    {
       
	    $.getJSON("groupbyajax/user!checkUserEmail.action",{email:email},function(data){
            var div='';
            if(data.success)
            {
               isSuccessEmail=true;
               
               div="<span id='errorInfor' ><font color='blue'>Email 正确！</font></span>";
            }else
            {
               isSuccessEmail=false;
               div="<span id='errorInfor' ><font color='red'>Email 不存在，请确认！</font></span>";
            }
            $("input[name='email']").after(div); 
            
	    });
    }
    return isSuccessEmail;
 }
 
 function findPassword()
 {
    var email=$("input[name='email']").val();
    
    if(!isSuccessEmail)
    {
       return false;
    }
   
    $.getJSON("groupbyajax/user!findUserPassword.action?time="+new Date().getTime(),{email:email},function(data){
      if(data.success)
      {
          alert("密码已经发到你的邮箱，请查收！");
      }else
      {
          alert("密码找回失败！");
      }
       
    });
 }

</script>
</head>

<body>
<div class="container">


<jsp:include page="head.jsp"/> 

<div class="content">

<div class="input_lan">
密码找回
</div>

<div class="wrap">
<form id="userForm" action="user!userRegister.action" method="post">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  
  <tr>
    <td height="35"><span class="input_ziti">你的电子邮箱:</span></td>
    <td height="25">&nbsp;</td>
  </tr>
  <tr>
    <td height="25"><label>
      <input name="email" type="text" size="30" onblur="checkUserEmail()" />
    </label></td>
    <td rowspan="7" align="left" valign="top">
    <span class="input_ziti">说明：</span>&nbsp;&nbsp;&nbsp;&nbsp;输入你在本网站的注册邮箱，密码将会发到你的邮箱中。</td>
  </tr>
  <tr>
    <td height="25" align="right" valign="middle"><button onclick="findPassword()">确定</button></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
</div>

</div>

<div id="foot"><jsp:include page="bot.jsp"></jsp:include></div>

</div>
</body>
</html>
